# -*- coding: utf-8 -*-
# @Time    : 2024/8/30 下午3:33
# @Author  : liujun
# @Email   : 2592730854@qq.com
# @File    : source_details_page.py
# @Software: PyCharm

from selenium.webdriver.common.by import By
from pages.base_page import BasePage
from selenium.webdriver.support.select import Select

class SourceDetailsPage(BasePage):
    """线索详情"""
    url="/crm/index.php?m=leads&a=view&id=74"
    delete_locator = (By.LINK_TEXT, "删除")  # 删除
    communication_log_add_locator = (By.CSS_SELECTOR, "#right_list > ul > li:nth-child(2) > a")  # 添加沟通日志
    communication_log_title_locator = (By.ID, "subject")  # 标题
    communication_log_add_btn_locator = (By.CSS_SELECTOR,
                                         "#dialog-log > form > table > tbody > tr:nth-child(5) > td:nth-child(2) > input.btn.btn-primary")  # 添加

    def click_delete(self):
        """点击删除"""
        self.driver.find_element(*self.delete_locator).click()
    def accept(self):
        """确定弹框"""
        self.driver.switch_to.alert.accept()
    def click_communication_log_add(self):
        """点击添加沟通日志"""
        self.driver.find_element(*self.communication_log_add_locator).click()
    def input_communication_log_title(self,communication_log_title):
        """输入标题"""
        self.driver.find_element(*self.communication_log_title_locator).send_keys(communication_log_title)
    def click_ommunication_log_add_btn(self):
        """点击添加"""
        self.driver.find_element(*self.communication_log_add_btn_locator).click()














